package com.cskaoyan.app.wxcontroller;

import com.cskaoyan.app.bean.bo.adminbo.AdminDelBo;
import com.cskaoyan.app.bean.bo.adminbo.AdminListBo;
import com.cskaoyan.app.bean.common.BasePageInfo;
import com.cskaoyan.app.bean.common.BaseRespVo;
import com.cskaoyan.app.bean.common.CommonData;
import com.cskaoyan.app.bean.po.MarketFootprint;
import com.cskaoyan.app.bean.po.MarketGoods;
import com.cskaoyan.app.bean.vo.adminVo.AdminBaseVo;
import com.cskaoyan.app.wxservice.WxFootPrintService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author kiggy
 * @since 2023/01/01 15:20
 */
@RestController
@RequestMapping("wx/footprint")
public class WxFootPrintController {

    @Autowired
    WxFootPrintService footPrintService;

    @GetMapping("list")
    public BaseRespVo list(AdminListBo listBo){
        CommonData<MarketGoods> data = footPrintService.listFootPrint(listBo);
        if (data==null){
            BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
            baseRespVo.setErrno(200);
            baseRespVo.setErrmsg("成功");
            return baseRespVo;
        }
        return BaseRespVo.ok(data);
    }

    /**
     * 0:没有异常
     * @return
     */
    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody AdminDelBo delBo){
        int status = footPrintService.deleteFootPrint(delBo.getId());
        return BaseRespVo.ok(null);
    }

}
